/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package plantcolorrmiserver;

import java.rmi.AlreadyBoundException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

/**
 *
 * @author Brandan
 */
public class Server {
    private static final int PORT = 1099;
    private static Registry registry;
    
    public static void startRegistry() throws RemoteException {
        registry = LocateRegistry.createRegistry(PORT);
    }
    
    public static void registerObject(String name, Remote remoteObj) throws RemoteException, AlreadyBoundException {
        registry.bind(name, remoteObj);
        System.out.println("REgistered: " + name + " - > " + remoteObj.getClass().getName() + " [ " + remoteObj + " ] ");
    }
    
    public static void main(String[] args) throws Exception {
        startRegistry();
        registerObject(PlantColor.class.getSimpleName(), new PlantColor());
        Thread.sleep(5 * 60 * 1000);
    }
    
}
